//
//  ZSLSearchView.swift
//  micro_blog
//
//  Created by Mac on 16/9/19.
//  Copyright © 2016年 Mac. All rights reserved.
//

import UIKit

class ZSLSearchView: UIView {

    @IBOutlet weak var SearchRightTextField: NSLayoutConstraint!
    
    @IBOutlet weak var searchButton: UIButton!
    @IBOutlet weak var searchTextField: UITextField!
    
    @IBAction func editBeginAction(_ sender: AnyObject)
    {
        SearchRightTextField.constant = searchButton.width
        
        UIView.animate(withDuration: 0.3) { 
            
            self.layoutIfNeeded()
        }
        
    }
    
    @IBAction func searchButtonActon(_ sender: AnyObject)
    {
        searchTextField.resignFirstResponder()
        
        SearchRightTextField.constant = 0
        
        UIView.animate(withDuration: 0.3) {
            
            self.layoutIfNeeded()
        }
        
    }
    
    class func searchView() -> ZSLSearchView {
        
        return UINib(nibName: "ZSLSearchView", bundle: nil).instantiate(withOwner: nil, options: nil).last! as! ZSLSearchView
    }
}
